Skip to content

Split TASTy reflect interface and implementation #4905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 10, 2018

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Aug 7, 2018

Mostly to simplify the maintainability and documentation of distinct parts of the implementation.
Abstract types are defined separately in TastyCore to avoid cake pattern (except for Printers).
Extracted the show extension methods to avoid cakes.

@nicolasstucki nicolasstucki self-assigned this Aug 8, 2018
@nicolasstucki nicolasstucki force-pushed the split-tasty-reflect branch 2 times, most recently from 0e8565a to 5c2ad6b Compare August 8, 2018 09:34
@nicolasstucki nicolasstucki force-pushed the split-tasty-reflect branch 2 times, most recently from cca03c2 to 19aab74 Compare August 9, 2018 15:53
@nicolasstucki nicolasstucki changed the title Split tasty reflect Split TASTy reflect interface and implementation Aug 9, 2018
Mostly to simplify the maintainability and documentation of distinct parts of the implementation.
Abstract types are defined separately in TastyCore to avoid cake pattern (except for Printers).
Extracted the `show` extension methods to avoid cakes.
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, LGTM

* +- Constant
*
* ```
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice diagram 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

type DefDef <: Definition
type ValDef <: Definition
type PackageDef <: Definition
type Term <: Statement with Parent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the TODO, it's implied type Parent = Term | TypeTree. How do we write the constraint for Term after the change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just type Term <: Statement. The TODO referes to the other places where Parent is used, mainly in the return type of extractors. I will clarify the coment.


type CaseDef

type Pattern
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we constrain Pattern, CaseDef by <: Tree?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is tempting but no. If we do so we would encounter ambiguities when using the extractor for Term.Ident and Pattern.Value, both have an underlyingtpd.Ident and cannot be distinguished at runtime. CaseDef could be a Tree but there is no place where something can return a CaseDef or some Tree.


type ImportSelector

type Id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between Ident and Id? A doc comment can be helpful here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Id is an untyped Ident and Id does not provide the tpe method. It is used to give a position to a name such as in imports.

@nicolasstucki
Copy link
Contributor Author

@Blaisorblade could you have a quick look to make sure I did not lose anything while rebasing of the last PR.

Copy link
Contributor

@Blaisorblade Blaisorblade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolasstucki Our fixes from #4904 seem to have gotten here fine :-) — that's what you meant I guess? LGTM!

@nicolasstucki
Copy link
Contributor Author

Yes, that is what I meant.

@Blaisorblade Blaisorblade merged commit 652092b into scala:master Aug 10, 2018
@Blaisorblade Blaisorblade deleted the split-tasty-reflect branch August 10, 2018 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants